package org.vaadinetherealintegration.client.example4;

import etrl.core.NodeCallback;
import etrl.core.Transform;
import etrl.vecmath.Vector3f;

public class RotationCallback implements NodeCallback
{
	Transform _transform;
	float _step;
	boolean _incr;
	
	public RotationCallback(Transform transform)
	{
		_transform = transform;
		_step = 0.f;
		_incr = true;
	}	
	public void doIt()
	{
		_transform.rotate(new Vector3f(1.f - _step, 0.f + _step, 0.f), 2.f, true);
		
		if(_step >= 1.f) _incr = false;
		if(_step <= 0.f) _incr = true;
		
		_step += _incr ? 0.02f : -0.02f;
	}

}
